package com.rest.demo.io;

import java.io.*;

/**
 * @author Administrator
 * @decription
 * @Date 2018-02-05 14:48
 */
public class InputStreamReaderDemo {
    public static void main(String[] args) {
        Reader reader = null;
        StringBuffer sb = new StringBuffer();
        try {
            reader = new InputStreamReader(new FileInputStream("F:\\out.txt"));
            char[] buff = new char[1024];
            int c = -1;
            while((c = reader.read(buff)) != -1) {
                sb.append(new String(buff,0,c));
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                reader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        System.out.println(sb.toString());
    }
}
